<template>
  <div class="app-container">
    <div class="head">
      <img src="@/assets/img/Layout/position.png" />
      <p class="see-block">客户下发详情</p>
    </div>
    <div class="view-container">
      <el-row class="status-title">
        <el-col :span="10" class="status-container">
          <div class="status-item">
            <span :class="{ 'active' : detailData.isSuccess == 1 }">执行成功</span>
            <span :class="{ 'active' : detailData.isSuccess == 0 }">执行失败</span>
          </div>
        </el-col>
      </el-row>
      <el-row class="detail-item">
        <el-col :span="24">
            <span>编码：</span>{{ detailData.coding ?  detailData.coding : '暂无' }}
        </el-col>
      </el-row>
      <el-row class="detail-item">
        <el-col :span="24">
            <span>下发类型：</span>{{ detailData.dataType == 3 ?  '客户下发' : detailData.dataType == 5 ? '会员下发' : ''}}
        </el-col>
      </el-row>
      <el-row class="detail-item">
        <el-col :span="24" style="align-items:normal;">
          <span>选择公司组织：</span>
          <div>
            <p v-for="(i, index) in orgNames" :key="index">{{ i }}</p>
          </div>
        </el-col>
      </el-row>
      <el-row class="detail-item">
        <el-col :span="24">
            <span>客户类型：</span>
            <template v-if="detailData.dataType == 3">企业客户</template>
            <template v-if="detailData.dataType == 5">会员客户</template>
        </el-col>
      </el-row>
      <el-row class="detail-item">
        <el-col :span="24" style="align-items:normal;">
          <span>选择客户：</span>
          <div v-if="detailData.dataType == 5">
            <p v-for="i in detailData.datas" :key="i.id">{{ i.phone + '—' + i.nickName }}</p>
          </div>
          <div v-else>
            <p v-for="i in detailData.datas" :key="i.id">{{ i.code + '—' + i.name }}</p>
          </div>
        </el-col>
      </el-row>
      <el-row class="detail-item">
        <el-col :span="24">
          <span>下发状态：</span>
          <!-- {{ detailData.isSuccess == 1 ?  '成功' : '失败'}} -->
          <font v-if="detailData.isSuccess == 0" style="color:#fd562c">失败</font>
          <font v-if="detailData.isSuccess == 1" style="color:#52C41A">成功</font>
        </el-col>
      </el-row>
      <el-row class="detail-item">
        <el-col :span="24">
          <span>执行人：</span>{{ detailData.createBy ?  detailData.createBy : '暂无'  }}
        </el-col>
      </el-row>
      <el-row class="detail-item">
        <el-col :span="24">
          <span>执行时间：</span>{{ detailData.createTime ?  detailData.createTime : '暂无'  }}
        </el-col>
      </el-row>
    </div>
  </div>
</template>

<script>
import { detailProductDataReleased } from "@/api/system/basedata/dataReleased/dataReleased"
export default {
  name: "userDetail",
  data(){
    return {
      id: '',
      detailData: '',
      orgNames: []
    }
  },
  created() {
    this.id = this.$route.query.id
    this.getDetailData()
  },
  methods: {
    // 获取详情信息
    getDetailData() {
      detailProductDataReleased(this.id).then(res => {
        this.detailData = res.data
        this.orgNames = this.detailData.orgNames.split(',')
      })
    }
  }
}
</script>